package ACM.lenovo;
import java.util.*;

/**
 * @Author wwk
 * @DATE 2022/8/19 19:12
 */
public class second {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt(); //size
        while(n-->0){
            ArrayList<Integer> alice = new ArrayList<>();
            ArrayList<Integer> bob = new ArrayList<>();
            for(int i=0; i<6; i++){
                String next = scanner.next();
                int num = 0;
                if(next.equals("A")){
                    num = 8;
                }else{
                    num = Integer.parseInt(next);
                }
                if(i<3){
                    alice.add(num);
                }else{
                    bob.add(num);
                }
            }



            int ali = isSan(alice);
            int bo = isSan(bob);
            if(ali > bo){
                System.out.println("Alice");
            }else if(bo > ali){
                System.out.println("Bob");
            }else{
                if(ali==3){
                    if(alice.get(0) == bob.get(0)){
                        System.out.println("Tie");
                    }else if (alice.get(0) > bob.get(0)){
                        System.out.println("Alice");
                    }else{
                        System.out.println("Bob");
                    }
                    break;
                }
                else if(ali == 2){
                    //等级相同,逆序排序,找到重复的那个
                    HashSet<Integer> integers = new HashSet<>();
                    HashSet<Integer> integers1 = new HashSet<>();
                    alice.sort((o1, o2) -> o2 - o1);
                    bob.sort((o1, o2) -> o2 - o1);
                    int a = 0;
                    int b = 0;
                    for (Integer integer : alice) {
                        if(!integers.add(integer)){
                            a = integer;
                        }
                    }
                    for (Integer integer : bob) {
                        if(!integers1.add(integer)){
                            b = integer;
                        }
                    }
                    if(a>b){
                        System.out.println("Alice");
                        break;
                    }else if(a<b){
                        System.out.println("Bob");
                        break;
                    }else{
                        //双相同，判别单的
                        int sum1 = 0;
                        for (Integer integer : integers) {
                            sum1 += integer;
                        }
                        int sum2 = 0;
                        for (Integer integer : integers1) {
                            sum2 += integer;
                        }
                        a = sum1-a;
                        b = sum2-b;
                        if(a==b){
                            System.out.println("Tie");
                        }else if( a>b){
                            System.out.println("Alice");
                        }else{
                            System.out.println("Bob");
                        }
                    }
                }
                else if(ali==1){
                    //等级相同,逆序排序
                    alice.sort((o1, o2) -> o2 - o1);
                    bob.sort((o1, o2) -> o2 - o1);
                    int lenA = 0;
                    int lenB = 0;
                    while(lenA < 3 && lenB < 3){
                        if(alice.get(lenA) > alice.get(lenB)){
                            System.out.println("Alice");
                            break;
                        }else if(alice.get(lenA) < alice.get(lenB)){
                            System.out.println("Bob");
                            break;
                        }else{
                            lenA++;
                            lenB++;
                        }
                    }
                    if(lenA==3 && lenB==3){
                        System.out.println("Tie");
                    }
                }

            }
        }
    }

    private  static int isSan(ArrayList<Integer> alice){
        HashSet<Integer> set = new HashSet<>(alice);
        if(set.size()==1){
            return 3;
        }
        if(set.size()==2){
            return 2;
        }
        return 1;
    }
}
